<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" class="queryParams">
      <el-form-item label="患者档案号:" prop="logId">
        <el-input v-model="queryParams.logId" placeholder="请输入患者档案号" clearable style="width: 180px;" size="small" @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="患者姓名:" prop="logId">
        <el-input v-model="queryParams.logId" placeholder="请输入患者姓名" clearable style="width: 180px;" size="small" @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="身份证号:" prop="logId">
        <el-input v-model="queryParams.logId" placeholder="请输入身份证号" clearable style="width: 180px;" size="small" @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="建档机构名称:" prop="executeResultCode">
        <el-select v-model="queryParams.executeResultCode" placeholder="请选择建档机构名称" clearable size="small" style="width: 180px">
          <el-option :label="item.label" :value="item.value" v-for="item in orgList" :key="item.id" />
        </el-select>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>

      </el-form-item>
    </el-form>

    <el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange">
      <!-- <el-table-column type="selection" width="55" align="center" /> -->
      <el-table-column label="档案号" prop="logId" width="300" show-overflow-tooltip />
      <el-table-column label="库/表名" prop="schemaTable" width="300" show-overflow-tooltip />
      <el-table-column label="库/表名" prop="schemaTable" width="300" show-overflow-tooltip />
      <el-table-column label="库/表名" prop="schemaTable" width="300" show-overflow-tooltip />
      <el-table-column label="库/表名" prop="schemaTable" width="300" show-overflow-tooltip />
      <el-table-column label="操作时间" prop="createTime" width="150" show-overflow-tooltip />

      <el-table-column label="操作" width="160" align="center" class-name="small-padding fixed-width" fixed="right">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)">查看详细</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :page-sizes="[15, 20, 30, 50]" :limit.sync="queryParams.pageSize" @pagination="getList" />

  </div>
</template>

<script>

import { listLog } from "@/api/areaSystem/synchronizationLog";

export default {

  data() {
    return {
      // 遮罩层
      loading: true,

      // 选中数组
      ids: [],
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 表格数据
      list: [],

      // 建档机构 列表
      orgList: [{
        id: 0,
        value: '',
        label: '全部'
      }, {
        id: 1,
        value: '1',
        label: '陇西县第一人民医院'
      }, {
        id: 2,
        value: '2',
        label: '陇西县第二人民医院'
      }],


      // 表单参数
      form: {},
      // 查询参数
      queryParams: {

        //执行结果
        executeResultCode: '',
        //日志id
        logId: '',
        createTime: '',
        updateTime: '',
        pageNum: 1,
        pageSize: 15

      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询同步日志 */
    getList() {
      this.loading = true;
      listLog(this.queryParams).then(response => {
        this.list = response.rows;
        this.total = response.total;
        this.loading = false;
      }
      );
    },

    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");

      this.handleQuery();
    },
    /** 多选框选中数据 */
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.operId)
      this.multiple = !selection.length
    },

    /** 详细按钮操作 */
    handleView(row) {
      console.log("详细按钮操作", row)
      this.$router.push({  //核心语句
        path:'./inspectioncollaborationDetails',   //跳转的路径
        query:{           //路由传参时push和query搭配使用 ，作用时传递参数
          id:row.logId , 
        }
      })
    },

  }
};
</script>

